38 #include "fsl_debug_console.h" 41 #include "clock_config.h" 44 #include "Driver_I2C.h" 45 #include "Driver_I2C_SDK2.h" 59 #include "event_groups.h" 68 static void read_task(
void *pvParameters);
74 ARM_DRIVER_I2C*
I2Cdrv = &I2C_S_DRIVER_BLOCKING;
77 BOARD_InitDebugConsole();
79 I2Cdrv->Initialize(NULL);
80 I2Cdrv->Control(ARM_I2C_BUS_SPEED, ARM_I2C_BUS_SPEED_FAST);
92 xTaskCreate(
read_task,
"READ", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY + 2, NULL);
93 xTaskCreate(
fusion_task,
"FUSION", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY + 1, NULL);
96 vTaskStartScheduler();
104 portTickType lastWakeTime;
105 const portTickType frequency = 1;
106 lastWakeTime = xTaskGetTickCount();
110 vTaskDelayUntil(&lastWakeTime, frequency);
void initSensorFusionGlobals(SensorFusionGlobals *sfg, StatusSubsystem *pStatusSubsystem, ControlSubsystem *pControlSubsystem)
utility function to insert default values in the top level structure
int8_t FXLS8952_Read(PhysicalSensor *sensor, SensorFusionGlobals *sfg)
int32_t loopcounter
counter incrementing each iteration of sensor fusion (typically 25Hz)
conditionSensorReadings_t * conditionSensorReadings
preprocessing step for sensor fusion
SensorFusionGlobals sfg
This is the primary sensor fusion data structure.
void initializeStatusSubsystem(StatusSubsystem *pStatus)
initializeStatusSubsystem() should be called once at startup to initialize the data structure and to ...
The top level fusion structure.
streamData_t * stream
function to create packets for serial stream
installSensor_t * installSensor
function for installing a new sensor into t
StatusSubsystem() provides an object-like interface for communicating status to the user...
readSensors_t * readSensors
read all physical sensors
struct ControlSubsystem * pControlSubsystem
static void fusion_task(void *pvParameters)
initializeFusionEngine_t * initializeFusionEngine
set sensor fusion structures to initial values
updateStatus_t * updateStatus
status=next status
int main(void)
This is a FreeRTOS (dual task) implementation of the NXP sensor fusion demo build.
int8_t FXAS21002_Read(PhysicalSensor *sensor, SensorFusionGlobals *sfg)
The sensor_fusion.h file implements the top level programming interface.
PhysicalSensor sensors[3]
This implementation uses three physical sensors.
int8_t MAG3110_Read(PhysicalSensor *sensor, SensorFusionGlobals *sfg)
Provides function prototypes for driver level interfaces.
he ControlSubsystem encapsulates command and data streaming functions.
uint8_t sUARTOutputBuffer[256]
main output buffer defined in control.c
EventGroupHandle_t event_group
int8_t initializeControlPort(ControlSubsystem *pComm)
Initialize the control subsystem and all related hardware.
runFusion_t * runFusion
run the fusion routines
Provides a simple abstraction for a periodic interval timer.
int8_t FXLS8952_Init(PhysicalSensor *sensor, SensorFusionGlobals *sfg)
ARM_DRIVER_I2C * I2Cdrv
KSDK handle for the I2C port defined in Driver_I2C_KSDK2.c.
Non-recoverable FAULT = something went very wrong.
ControlSubsystem controlSubsystem
used for serial communications
Application-specific status subsystem.
static void read_task(void *pvParameters)
An instance of PhysicalSensor structure type should be allocated for each physical sensors (combo dev...
int8_t MAG3110_Init(PhysicalSensor *sensor, SensorFusionGlobals *sfg)
setStatus_t * queueStatus
queue status change for next regular interval
Defines control sub-system.
setStatus_t * setStatus
change status indicator immediately
StatusSubsystem statusSubsystem
provides visual (usually LED) status indicator
applyPerturbation_t * applyPerturbation
apply step function for testing purposes
int8_t FXAS21002_Init(PhysicalSensor *sensor, SensorFusionGlobals *sfg)